import ajax from '@/utils/request'
import { concatUrl } from '@/utils'

// 抽奖
export function drawTurntable(data= {}) {
    return ajax({
        url: concatUrl('/v1/activity/turntable/draw'),
        data,
        method: 'POST'
    })
}

// 分享
export function shareTurntable(data= {}) {
    return ajax({
        url: concatUrl('/v1/activity/turntable/share'),
        data,
        method: 'POST'
    })
}

// 抽奖详情
export function getTurntable(data= {}, fields: string | object = { fields: 'activityId,name,title,keyword,rule,bgPath,startAt,endAt,award,award.position,award.name,award.path,remainDrawCount,isShareAddTimes' }) {
    return ajax({
        url: concatUrl('/v1/activity/turntable/view',fields),
        data,
        method: 'GET'
    })
}

// 抽奖记录
export function getWinningLog(data= {}, fields: string | object = { fields: 'id,awardPath,awardName,mobile,createdAt' }) {
    return ajax({
        url: concatUrl('/v1/activity/winning-log/index',fields),
        data,
        method: 'GET'
    })
}

// 奖品记录
export function getQualifications(data= {}, fields: string | object = { fields: 'activityId,activity.name,userId,user.mobile,storeCode,belongType,storeName,vendorName,cityName,carLicense,relatedCode,createdAt,statusLabel,typeLabel' }) {
	return ajax({
			url: concatUrl('/v1/activity/turntable/get-my-award',fields),
			data,
			method: 'GET'
	})
}
